﻿using LEE.EntityFrameworkCore.Extentions.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text;

namespace LEE.EntityFrameworkCore.Extentions
{
    public static class SortExtension
    {
        public static IQueryable<T> OrderBy<T>(this IQueryable<T> source, ISort model)
        {
            if (!string.IsNullOrWhiteSpace(model.SortName))
                source = source.OrderBy($"{model.SortName} {model.SortType}");
            return source;
        }
    }
}
